/*******************************************************************/
/* @ All Rights Reserved Copyright (C) 2014 broada,Co.,Ltd.        */
/*                                                                 */
/*  NAME      = t_frtask_mng_init.c                                */
/*  NOTE      =                                                    */
/*  DATE      = 2014/12/18 by geyh                                 */
/*******************************************************************/

#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include <CUnit/Basic.h>
#include <CUnit/CUnit.h>

#include "frcomm.h"
#include "frlog.h"
#include "frmem.h"
#include "frlist.h"
#include "conntrack.h"
#include "frame.h"
#include "frtask_mng.h"
#include "apmtest_cunit.h"

static int __suite_init(void)
{
	return 0;
}

static int __suite_cleanup(void)
{
	return 0;
}

extern Frlist_header g_lst_hdr_task;

static void case1(void)
{
    Frlist_node *p_st_node = NULL;
    char *p_tmp = NULL;

    p_tmp = (char *)frmalloc(5);

    p_st_node = frlist_node_create(p_tmp);

    g_lst_hdr_task.size = 10;
    g_lst_hdr_task.tail = p_st_node;
    g_lst_hdr_task.head = p_st_node;

    frtask_mng_init();

    CU_ASSERT_EQUAL(g_lst_hdr_task.size,0);
    CU_ASSERT_PTR_NULL(g_lst_hdr_task.tail);
    CU_ASSERT_PTR_NULL(g_lst_hdr_task.head);

    frfree(p_tmp);
    frfree(p_st_node);

}


int add_suite()
{
	CU_pSuite pSuite = NULL;

	pSuite = CU_add_suite("t_frtask_mng_init 测试", __suite_init, __suite_cleanup);

	if (NULL == pSuite)
	{
		return 1;
	}


    //增加测试用例
   	CU_add_test(pSuite, "case1", case1);

    return 0;

}

int main(int argc, char **argv)
{
    fr_slab_init(52428800, "test");
    run_cunit(add_suite);
    fr_slab_destroy();

    return 0;
}